$(function () {
    // 银行卡号的姓名
    var username = localStorage.getItem("username");
    var uid = localStorage.getItem("uid");
    $(".list-main tr .name").html(username);
    // 注销
    $(".login-out").click(function () {
        if (confirm("您确定要退出吗？")) {
            localStorage.removeItem("username");
            localStorage.removeItem("uid");
        } else {
            return false;
        }

    })

    // 充值金额按钮注册效果
    $(".btn-primary").click(function () {

        var chargemoney = $("#chargemoney").val();
        if (!chargemoney == "") {
            $.ajax({
                url: "http://localhost:8848/charge.php",
                type: "POST",
                data: {
                    id: uid,
                    bankcode: $(".bankcode").val(),
                    chargemoney: chargemoney
                },
                success: function (data) {
                    if (data == "ok") {
                        alert("充值成功，请不要重复点击，页面即将跳转");
                        location.href = "/#personal";
                    } else {
                        alert("充值失败，请稍后再试");
                    }
                }

            })
        } else {
            return false;
        }
    })

})